<?php
	
	function searchUsers($table_data){
		global $wpdb;
		if(!isset($table_data['client_name'])){
			echo "";
		}

		$client_name = $table_data['client_name'];
		$names = explode(" ", $client_name);

		$sql = "SELECT idclient client_id, client_name, client_contact FROM  `timetable_client` WHERE ";

		$whs = array();
		foreach ($names as $value) {
			$whs[] = "client_name LIKE  '%{$value}%'";
		}		
		
		$sql .= $whs_str = implode(" OR ", $whs);
		$res = $wpdb->get_results($sql, ARRAY_A);
		echo json_encode($res);

	}

?>